import {
  getUserInfoById
} from "../../api/user.js";

Page({

  /**
   * 页面的初始数据
   */
  data: {
    usersinfo: {}
  },

  onLoad() {
    var that = this
    let data = wx.getStorageSync('usersinfo')
    that.setData({
      usersinfo: JSON.parse(data)
    })
    let id = {
      id: that.data.usersinfo.id
    }
    getUserInfoById(id).then(res => {
      if (res.code == '200') {
        that.setData({
          usersinfo: res.data
        })
      }
    })
  },
  handle () {
    wx.showToast({
      title: "功能开发中...",
      icon: 'none',
      duration: 2000
    })
},
  logout() {
    wx.clearStorageSync("usersinfo")
    wx.reLaunch({
      url: '/pages/login/login',
    })
  }
})